import _ZJ_h5manage_001 from '../zj-h5manage-001/n';

import html from './html';
import s from './ns';

import init from '@feidao/web/framework/nodejs/d/page';

////////////////////////////////////////////////////////////////////////////////

// atoms import
////////////////////////////////////////////////////////////////////////////////

feidao_exports.default = async (url: string) => {
	const daoke = {};

	const res = await init(html, url, s, daoke, _ZJ_h5manage_001);
	const html_str = `<!DOCTYPE html>
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>H5管理</title>
		<link rel="shortcut icon" href="./css/favicon.ico" />
		<link href="./css/feidao.css" type="text/css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="./css/iconfont.css">
		<link rel="stylesheet" type="text/css" href="./css/daokes.css">

		<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

		<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs/webcomponents-loader.js"></script>

		<script type="text/javascript">
			window.addEventListener('WebComponentsReady', function () {
				var t1 = document.createElement('script');
				t1.src = './js/feidao.js';
				document.head.appendChild(t1);
				var t2 = document.createElement('script');
				t2.src = './js/h5manage.js';
				document.head.appendChild(t2);
			});
		</script>
	</head>

	<body>
	${html.toString()}
	</body>
	</html>`;
	const html_obj = { data: html_str };
	if (typeof res === 'object' && Object.keys(res).length > 0) {
		const result = Object.assign({}, res, html_obj);
		return result;
	}
	return html_obj;
}
